from django.db import models
from django.utils import timezone
# Create your models here.

# apk信息的字段
class APK(models.Model):
    activities = models.TextField(blank=True)
    permissions = models.TextField(blank=True)
    package = models.CharField(max_length=255, verbose_name='package',blank=True)
    app_name = models.CharField(max_length=255, verbose_name='app name',blank=True)
    version_name = models.CharField(max_length=255, verbose_name='version name',blank=True)
    version_code = models.CharField(max_length=255, verbose_name='version code',blank=True)
    hash_algo = models.TextField(verbose_name='hash algo',blank=True)
    serial_number = models.TextField(verbose_name='serial number',blank=True)
    contents_der = models.TextField(verbose_name='contents derivation',blank=True)
    issuer = models.CharField(max_length=255, verbose_name='issuer',blank=True)
    md5 = models.CharField(max_length=255, verbose_name='md5',blank=True)
    sha1 = models.CharField(max_length=255, verbose_name='sha1',blank=True)
    sha256 = models.CharField(max_length=255, verbose_name='sha256',blank=True)
    validity_period = models.CharField(max_length=255, verbose_name='validity period',blank=True)
    signature_algo = models.CharField(max_length=255, verbose_name='signature algo',blank=True)
    intent = models.TextField(verbose_name='intent',blank=True)
    icon_url = models.TextField(verbose_name='icon url',blank=True)
    apk_size = models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    folder_size =models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    ret = models.CharField(max_length=255, verbose_name='ret',blank=True)
    record_time = models.DateTimeField(default=timezone.now, verbose_name='检测时间')

    class Meta:
        db_table = 'apk_db'

class Blacklist(models.Model):
    activities = models.TextField(blank=True)
    permissions = models.TextField(blank=True)
    package = models.CharField(max_length=255, verbose_name='package',blank=True)
    app_name = models.CharField(max_length=255, verbose_name='app name',blank=True)
    version_name = models.CharField(max_length=255, verbose_name='version name',blank=True)
    version_code = models.CharField(max_length=255, verbose_name='version code',blank=True)
    hash_algo = models.TextField(verbose_name='hash algo',blank=True)
    serial_number = models.TextField(verbose_name='serial number',blank=True)
    contents_der = models.TextField(verbose_name='contents derivation',blank=True)
    issuer = models.CharField(max_length=255, verbose_name='issuer',blank=True)
    md5 = models.CharField(max_length=255, verbose_name='md5',blank=True)
    sha1 = models.CharField(max_length=255, verbose_name='sha1',blank=True)
    sha256 = models.CharField(max_length=255, verbose_name='sha256',blank=True)
    validity_period = models.CharField(max_length=255, verbose_name='validity period',blank=True)
    signature_algo = models.CharField(max_length=255, verbose_name='signature algo',blank=True)
    intent = models.TextField(verbose_name='intent',blank=True)
    icon_url = models.TextField(verbose_name='icon url',blank=True)
    apk_size = models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    folder_size =models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    ret = models.CharField(max_length=255, verbose_name='ret',blank=True)
    record_time = models.DateTimeField(default=timezone.now, verbose_name='检测时间')


    class Meta:
        db_table = 'blacklist_db'

class Whitelist(models.Model):
    activities = models.TextField(blank=True)
    permissions = models.TextField(blank=True)
    package = models.CharField(max_length=255, verbose_name='package',blank=True)
    app_name = models.CharField(max_length=255, verbose_name='app name',blank=True)
    version_name = models.CharField(max_length=255, verbose_name='version name',blank=True)
    version_code = models.CharField(max_length=255, verbose_name='version code',blank=True)
    hash_algo = models.TextField(verbose_name='hash algo',blank=True)
    serial_number = models.TextField(verbose_name='serial number',blank=True)
    contents_der = models.TextField(verbose_name='contents derivation',blank=True)
    issuer = models.CharField(max_length=255, verbose_name='issuer',blank=True)
    md5 = models.CharField(max_length=255, verbose_name='md5',blank=True)
    sha1 = models.CharField(max_length=255, verbose_name='sha1',blank=True)
    sha256 = models.CharField(max_length=255, verbose_name='sha256',blank=True)
    validity_period = models.CharField(max_length=255, verbose_name='validity period',blank=True)
    signature_algo = models.CharField(max_length=255, verbose_name='signature algo',blank=True)
    intent = models.TextField(verbose_name='intent',blank=True)
    icon_url = models.TextField(verbose_name='icon url',blank=True)
    apk_size = models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    folder_size =models.DecimalField(max_digits=20, decimal_places=2, verbose_name='apk size', blank=True, default=0)
    ret = models.CharField(max_length=255, verbose_name='ret',blank=True)
    record_time = models.DateTimeField(default=timezone.now, verbose_name='检测时间')

    class Meta:
        db_table = 'Whitelist_db'